﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MinhTuan;

public partial class admin_funcion_addcustommer : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            macapcha.Text = Access.MakeCapcha();
        }
    }
    protected void btndangky_Click(object sender, EventArgs e)
    {
       
        if(String.Compare(this.macapcha.Text.ToLower(),this.txtcapcha.Text.Trim().ToLower(),true)==0)
        {
            Members member = new Members();
            member.Members_Name = txthoten.Text;
            member.Members_City = txtthanhpho.Text;
            member.Members_Address = txtdiachi.Text;
            member.Members_Mail = txtemail.Text;
            member.Members_Tel = txtdienthoai.Text;
            member.Members_DateJoin = DateTime.Now;
            member.Members_LastLogin = DateTime.Now;
            member.Members_Login = txttendangnhap.Text;
            member.Members_Password = txtmatkhau.Text;
            int result = Members.AddMember(member);
            if (result > 0)
            {
                Lthongbao.Text = "Tài khoản " + member.Members_Name + " đăng ký thành công";
            }
            else
            {
                Lthongbao.Text = "Đăng ký không thành công";
            }
        }
        else
        {
            this.Lthongbao.Text="Mã xác nhận không đúng";
        }

    
    }
}
